(0) Obligation:
Runtime Complexity TRS:
The TRS R consists of the following rules:
gt(s(x), 0) → true
gt(0, y) → false
gt(s(x), s(y)) → gt(x, y)
divides(x, y) → div(x, y, y)
div(0, 0, z) → true
div(0, s(x), z) → false
div(s(x), 0, s(z)) → div(s(x), s(z), s(z))
div(s(x), s(y), z) → div(x, y, z)
prime(x) → test(x, s(s(0)))
test(x, y) → if1(gt(x, y), x, y)
if1(true, x, y) → if2(divides(x, y), x, y)
if1(false, x, y) → true
if2(true, x, y) → false
if2(false, x, y) → test(x, s(y))
Rewrite Strategy: INNERMOST
(1) RenamingProof (EQUIVALENT transformation)
Renamed function symbols to avoid clashes with predefined symbol.
(2) Obligation:
Runtime Complexity Relative TRS:
The TRS R consists of the following rules:
gt(s(x), 0') → true
gt(0', y) → false
gt(s(x), s(y)) → gt(x, y)
divides(x, y) → div(x, y, y)
div(0', 0', z) → true
div(0', s(x), z) → false
div(s(x), 0', s(z)) → div(s(x), s(z), s(z))
div(s(x), s(y), z) → div(x, y, z)
prime(x) → test(x, s(s(0')))
test(x, y) → if1(gt(x, y), x, y)
if1(true, x, y) → if2(divides(x, y), x, y)
if1(false, x, y) → true
if2(true, x, y) → false
if2(false, x, y) → test(x, s(y))
S is empty.
Rewrite Strategy: INNERMOST
(3) TypeInferenceProof (BOTH BOUNDS(ID, ID) transformation)
Infered types.
(4) Obligation:
Innermost TRS:
Rules:
gt(s(x), 0') → true
gt(0', y) → false
gt(s(x), s(y)) → gt(x, y)
divides(x, y) → div(x, y, y)
div(0', 0', z) → true
div(0', s(x), z) → false
div(s(x), 0', s(z)) → div(s(x), s(z), s(z))
div(s(x), s(y), z) → div(x, y, z)
prime(x) → test(x, s(s(0')))
test(x, y) → if1(gt(x, y), x, y)
if1(true, x, y) → if2(divides(x, y), x, y)
if1(false, x, y) → true
if2(true, x, y) → false
if2(false, x, y) → test(x, s(y))
Types:
gt :: s:0' → s:0' → true:false
s :: s:0' → s:0'
0' :: s:0'
true :: true:false
false :: true:false
divides :: s:0' → s:0' → true:false
div :: s:0' → s:0' → s:0' → true:false
prime :: s:0' → true:false
test :: s:0' → s:0' → true:false
if1 :: true:false → s:0' → s:0' → true:false
if2 :: true:false → s:0' → s:0' → true:false
hole_true:false1_0 :: true:false
hole_s:0'2_0 :: s:0'
gen_s:0'3_0 :: Nat → s:0'
(5) OrderProof (LOWER BOUND(ID) transformation)
Heuristically decided to analyse the following defined symbols:
gt,
div,
testThey will be analysed ascendingly in the following order:
gt < test
(6) Obligation:
Innermost TRS:
Rules:
gt(
s(
x),
0') →
truegt(
0',
y) →
falsegt(
s(
x),
s(
y)) →
gt(
x,
y)
divides(
x,
y) →
div(
x,
y,
y)
div(
0',
0',
z) →
truediv(
0',
s(
x),
z) →
falsediv(
s(
x),
0',
s(
z)) →
div(
s(
x),
s(
z),
s(
z))
div(
s(
x),
s(
y),
z) →
div(
x,
y,
z)
prime(
x) →
test(
x,
s(
s(
0')))
test(
x,
y) →
if1(
gt(
x,
y),
x,
y)
if1(
true,
x,
y) →
if2(
divides(
x,
y),
x,
y)
if1(
false,
x,
y) →
trueif2(
true,
x,
y) →
falseif2(
false,
x,
y) →
test(
x,
s(
y))
Types:
gt :: s:0' → s:0' → true:false
s :: s:0' → s:0'
0' :: s:0'
true :: true:false
false :: true:false
divides :: s:0' → s:0' → true:false
div :: s:0' → s:0' → s:0' → true:false
prime :: s:0' → true:false
test :: s:0' → s:0' → true:false
if1 :: true:false → s:0' → s:0' → true:false
if2 :: true:false → s:0' → s:0' → true:false
hole_true:false1_0 :: true:false
hole_s:0'2_0 :: s:0'
gen_s:0'3_0 :: Nat → s:0'
Generator Equations:
gen_s:0'3_0(0) ⇔ 0'
gen_s:0'3_0(+(x, 1)) ⇔ s(gen_s:0'3_0(x))
The following defined symbols remain to be analysed:
gt, div, test
They will be analysed ascendingly in the following order:
gt < test
(7) RewriteLemmaProof (LOWER BOUND(ID) transformation)
Proved the following rewrite lemma:
gt(
gen_s:0'3_0(
+(
1,
n5_0)),
gen_s:0'3_0(
n5_0)) →
true, rt ∈ Ω(1 + n5
0)
Induction Base:
gt(gen_s:0'3_0(+(1, 0)), gen_s:0'3_0(0)) →RΩ(1)
true
Induction Step:
gt(gen_s:0'3_0(+(1, +(n5_0, 1))), gen_s:0'3_0(+(n5_0, 1))) →RΩ(1)
gt(gen_s:0'3_0(+(1, n5_0)), gen_s:0'3_0(n5_0)) →IH
true
We have rt ∈ Ω(n1) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
(8) Complex Obligation (BEST)
(9) Obligation:
Innermost TRS:
Rules:
gt(
s(
x),
0') →
truegt(
0',
y) →
falsegt(
s(
x),
s(
y)) →
gt(
x,
y)
divides(
x,
y) →
div(
x,
y,
y)
div(
0',
0',
z) →
truediv(
0',
s(
x),
z) →
falsediv(
s(
x),
0',
s(
z)) →
div(
s(
x),
s(
z),
s(
z))
div(
s(
x),
s(
y),
z) →
div(
x,
y,
z)
prime(
x) →
test(
x,
s(
s(
0')))
test(
x,
y) →
if1(
gt(
x,
y),
x,
y)
if1(
true,
x,
y) →
if2(
divides(
x,
y),
x,
y)
if1(
false,
x,
y) →
trueif2(
true,
x,
y) →
falseif2(
false,
x,
y) →
test(
x,
s(
y))
Types:
gt :: s:0' → s:0' → true:false
s :: s:0' → s:0'
0' :: s:0'
true :: true:false
false :: true:false
divides :: s:0' → s:0' → true:false
div :: s:0' → s:0' → s:0' → true:false
prime :: s:0' → true:false
test :: s:0' → s:0' → true:false
if1 :: true:false → s:0' → s:0' → true:false
if2 :: true:false → s:0' → s:0' → true:false
hole_true:false1_0 :: true:false
hole_s:0'2_0 :: s:0'
gen_s:0'3_0 :: Nat → s:0'
Lemmas:
gt(gen_s:0'3_0(+(1, n5_0)), gen_s:0'3_0(n5_0)) → true, rt ∈ Ω(1 + n50)
Generator Equations:
gen_s:0'3_0(0) ⇔ 0'
gen_s:0'3_0(+(x, 1)) ⇔ s(gen_s:0'3_0(x))
The following defined symbols remain to be analysed:
div, test
(10) RewriteLemmaProof (LOWER BOUND(ID) transformation)
Proved the following rewrite lemma:
div(
gen_s:0'3_0(
n300_0),
gen_s:0'3_0(
n300_0),
gen_s:0'3_0(
c)) →
true, rt ∈ Ω(1 + n300
0)
Induction Base:
div(gen_s:0'3_0(0), gen_s:0'3_0(0), gen_s:0'3_0(c)) →RΩ(1)
true
Induction Step:
div(gen_s:0'3_0(+(n300_0, 1)), gen_s:0'3_0(+(n300_0, 1)), gen_s:0'3_0(c)) →RΩ(1)
div(gen_s:0'3_0(n300_0), gen_s:0'3_0(n300_0), gen_s:0'3_0(c)) →IH
true
We have rt ∈ Ω(n1) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
(11) Complex Obligation (BEST)
(12) Obligation:
Innermost TRS:
Rules:
gt(
s(
x),
0') →
truegt(
0',
y) →
falsegt(
s(
x),
s(
y)) →
gt(
x,
y)
divides(
x,
y) →
div(
x,
y,
y)
div(
0',
0',
z) →
truediv(
0',
s(
x),
z) →
falsediv(
s(
x),
0',
s(
z)) →
div(
s(
x),
s(
z),
s(
z))
div(
s(
x),
s(
y),
z) →
div(
x,
y,
z)
prime(
x) →
test(
x,
s(
s(
0')))
test(
x,
y) →
if1(
gt(
x,
y),
x,
y)
if1(
true,
x,
y) →
if2(
divides(
x,
y),
x,
y)
if1(
false,
x,
y) →
trueif2(
true,
x,
y) →
falseif2(
false,
x,
y) →
test(
x,
s(
y))
Types:
gt :: s:0' → s:0' → true:false
s :: s:0' → s:0'
0' :: s:0'
true :: true:false
false :: true:false
divides :: s:0' → s:0' → true:false
div :: s:0' → s:0' → s:0' → true:false
prime :: s:0' → true:false
test :: s:0' → s:0' → true:false
if1 :: true:false → s:0' → s:0' → true:false
if2 :: true:false → s:0' → s:0' → true:false
hole_true:false1_0 :: true:false
hole_s:0'2_0 :: s:0'
gen_s:0'3_0 :: Nat → s:0'
Lemmas:
gt(gen_s:0'3_0(+(1, n5_0)), gen_s:0'3_0(n5_0)) → true, rt ∈ Ω(1 + n50)
div(gen_s:0'3_0(n300_0), gen_s:0'3_0(n300_0), gen_s:0'3_0(c)) → true, rt ∈ Ω(1 + n3000)
Generator Equations:
gen_s:0'3_0(0) ⇔ 0'
gen_s:0'3_0(+(x, 1)) ⇔ s(gen_s:0'3_0(x))
The following defined symbols remain to be analysed:
test
(13) NoRewriteLemmaProof (LOWER BOUND(ID) transformation)
Could not prove a rewrite lemma for the defined symbol test.
(14) Obligation:
Innermost TRS:
Rules:
gt(
s(
x),
0') →
truegt(
0',
y) →
falsegt(
s(
x),
s(
y)) →
gt(
x,
y)
divides(
x,
y) →
div(
x,
y,
y)
div(
0',
0',
z) →
truediv(
0',
s(
x),
z) →
falsediv(
s(
x),
0',
s(
z)) →
div(
s(
x),
s(
z),
s(
z))
div(
s(
x),
s(
y),
z) →
div(
x,
y,
z)
prime(
x) →
test(
x,
s(
s(
0')))
test(
x,
y) →
if1(
gt(
x,
y),
x,
y)
if1(
true,
x,
y) →
if2(
divides(
x,
y),
x,
y)
if1(
false,
x,
y) →
trueif2(
true,
x,
y) →
falseif2(
false,
x,
y) →
test(
x,
s(
y))
Types:
gt :: s:0' → s:0' → true:false
s :: s:0' → s:0'
0' :: s:0'
true :: true:false
false :: true:false
divides :: s:0' → s:0' → true:false
div :: s:0' → s:0' → s:0' → true:false
prime :: s:0' → true:false
test :: s:0' → s:0' → true:false
if1 :: true:false → s:0' → s:0' → true:false
if2 :: true:false → s:0' → s:0' → true:false
hole_true:false1_0 :: true:false
hole_s:0'2_0 :: s:0'
gen_s:0'3_0 :: Nat → s:0'
Lemmas:
gt(gen_s:0'3_0(+(1, n5_0)), gen_s:0'3_0(n5_0)) → true, rt ∈ Ω(1 + n50)
div(gen_s:0'3_0(n300_0), gen_s:0'3_0(n300_0), gen_s:0'3_0(c)) → true, rt ∈ Ω(1 + n3000)
Generator Equations:
gen_s:0'3_0(0) ⇔ 0'
gen_s:0'3_0(+(x, 1)) ⇔ s(gen_s:0'3_0(x))
No more defined symbols left to analyse.
(15) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
gt(gen_s:0'3_0(+(1, n5_0)), gen_s:0'3_0(n5_0)) → true, rt ∈ Ω(1 + n50)
(16) BOUNDS(n^1, INF)
(17) Obligation:
Innermost TRS:
Rules:
gt(
s(
x),
0') →
truegt(
0',
y) →
falsegt(
s(
x),
s(
y)) →
gt(
x,
y)
divides(
x,
y) →
div(
x,
y,
y)
div(
0',
0',
z) →
truediv(
0',
s(
x),
z) →
falsediv(
s(
x),
0',
s(
z)) →
div(
s(
x),
s(
z),
s(
z))
div(
s(
x),
s(
y),
z) →
div(
x,
y,
z)
prime(
x) →
test(
x,
s(
s(
0')))
test(
x,
y) →
if1(
gt(
x,
y),
x,
y)
if1(
true,
x,
y) →
if2(
divides(
x,
y),
x,
y)
if1(
false,
x,
y) →
trueif2(
true,
x,
y) →
falseif2(
false,
x,
y) →
test(
x,
s(
y))
Types:
gt :: s:0' → s:0' → true:false
s :: s:0' → s:0'
0' :: s:0'
true :: true:false
false :: true:false
divides :: s:0' → s:0' → true:false
div :: s:0' → s:0' → s:0' → true:false
prime :: s:0' → true:false
test :: s:0' → s:0' → true:false
if1 :: true:false → s:0' → s:0' → true:false
if2 :: true:false → s:0' → s:0' → true:false
hole_true:false1_0 :: true:false
hole_s:0'2_0 :: s:0'
gen_s:0'3_0 :: Nat → s:0'
Lemmas:
gt(gen_s:0'3_0(+(1, n5_0)), gen_s:0'3_0(n5_0)) → true, rt ∈ Ω(1 + n50)
div(gen_s:0'3_0(n300_0), gen_s:0'3_0(n300_0), gen_s:0'3_0(c)) → true, rt ∈ Ω(1 + n3000)
Generator Equations:
gen_s:0'3_0(0) ⇔ 0'
gen_s:0'3_0(+(x, 1)) ⇔ s(gen_s:0'3_0(x))
No more defined symbols left to analyse.
(18) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
gt(gen_s:0'3_0(+(1, n5_0)), gen_s:0'3_0(n5_0)) → true, rt ∈ Ω(1 + n50)
(19) BOUNDS(n^1, INF)
(20) Obligation:
Innermost TRS:
Rules:
gt(
s(
x),
0') →
truegt(
0',
y) →
falsegt(
s(
x),
s(
y)) →
gt(
x,
y)
divides(
x,
y) →
div(
x,
y,
y)
div(
0',
0',
z) →
truediv(
0',
s(
x),
z) →
falsediv(
s(
x),
0',
s(
z)) →
div(
s(
x),
s(
z),
s(
z))
div(
s(
x),
s(
y),
z) →
div(
x,
y,
z)
prime(
x) →
test(
x,
s(
s(
0')))
test(
x,
y) →
if1(
gt(
x,
y),
x,
y)
if1(
true,
x,
y) →
if2(
divides(
x,
y),
x,
y)
if1(
false,
x,
y) →
trueif2(
true,
x,
y) →
falseif2(
false,
x,
y) →
test(
x,
s(
y))
Types:
gt :: s:0' → s:0' → true:false
s :: s:0' → s:0'
0' :: s:0'
true :: true:false
false :: true:false
divides :: s:0' → s:0' → true:false
div :: s:0' → s:0' → s:0' → true:false
prime :: s:0' → true:false
test :: s:0' → s:0' → true:false
if1 :: true:false → s:0' → s:0' → true:false
if2 :: true:false → s:0' → s:0' → true:false
hole_true:false1_0 :: true:false
hole_s:0'2_0 :: s:0'
gen_s:0'3_0 :: Nat → s:0'
Lemmas:
gt(gen_s:0'3_0(+(1, n5_0)), gen_s:0'3_0(n5_0)) → true, rt ∈ Ω(1 + n50)
Generator Equations:
gen_s:0'3_0(0) ⇔ 0'
gen_s:0'3_0(+(x, 1)) ⇔ s(gen_s:0'3_0(x))
No more defined symbols left to analyse.
(21) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
gt(gen_s:0'3_0(+(1, n5_0)), gen_s:0'3_0(n5_0)) → true, rt ∈ Ω(1 + n50)
(22) BOUNDS(n^1, INF)